package com.cctv.fmaed.module.redis.memory.pojo.po;

import com.cctv.fmaed.module.redis.memory.enums.QrCodeStateEnum;

import java.util.LinkedHashMap;

/**
 * 设备注册DTO
 *
 * @author heyingcheng
 * @since 2023/8/29
 */
public class QrCodeUuidPO extends LinkedHashMap<String, String> {

    public static final String HASH_KEY_UUID = "uuid";
    public static final String HASH_KEY_GUID = "guid";
    public static final String HASH_KEY_USER_ID = "user_id";
    public static final String HASH_KEY_STATE = "state";
    public static final String HASH_KEY_TIMESTAMP = "timestamp";

    public QrCodeUuidPO(String guid, String uuid, Integer state) {
        put(HASH_KEY_GUID, guid);
        put(HASH_KEY_UUID, uuid);
        put(HASH_KEY_STATE, String.valueOf(state));
        put(HASH_KEY_TIMESTAMP, String.valueOf(System.currentTimeMillis()));
    }

    public String getUuid() {
        return get(HASH_KEY_UUID);
    }

    public String getGuid() {
        return get(HASH_KEY_GUID);
    }

    public String getUserId() {
        return get(HASH_KEY_USER_ID);
    }

    public Integer getState() {
        return QrCodeStateEnum.stateOf(get(HASH_KEY_STATE));
    }

    public Long getTimestamp() {
        return Long.valueOf(get(HASH_KEY_TIMESTAMP));
    }

}
